<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
<style>
    .form-group{
        margin-bottom: 0;
    }
    .invoice-col{
        font-size: 14px;
    }
    .stitle{
        display: inline-block;
        width: 106px;
        margin-bottom: 10px;
    }
    .stitle1{
        display: inline-block;
        width: 88px;
        margin-bottom: 10px;
    }
    .stitle2{
        display: inline-block;
        width: 40px;
        margin-bottom: 10px;
    }

    .scontent{
        margin-left: 20px;
        width: 120px;
    }
    .modal-body{
        border-bottom: 1px solid rgba(0,0,0,.125) ;
    }
</style>
<head th:include="include/head">

</head>

<body class="hold-transition sidebar-mini layout-fixed">
<div class="wrapper">


    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <div class="container-fluid">
                <div class="row mb-2">
                    <div class="col-sm-6">
                        <h1>用户信息</h1>
                    </div>
                    <div class="col-sm-6">
                        <ol class="breadcrumb float-sm-right">
                            <li class="breadcrumb-item"><a href="#">首页</a></li>
                            <li class="breadcrumb-item active">流程设置</li>
                        </ol>
                    </div>
                </div>
            </div>
            <div  class="row">
                <div class="col-md-5">
                    <div class="row">
                        <div class="col-md-12">

                            <!-- Profile Image -->

                            <div class="card card-primary direct-chat-warning">
                                <div class="card-body box-profile">

                                    <div class="text-center">
                                        <img class="profile-user-img img-fluid img-circle"
                                             th:src="${detail.user.userPic}"
                                             alt="User profile picture">
                                    </div>

                                    <h3 class="profile-username text-center" th:text="${detail.user.userName}">Nina Mcintire</h3>

                                    <p class="text-muted text-center" th:text="${detail.user.userDesc}">Software Engineer</p>

                                    <ul class="list-group list-group-unbordered mb-3">
                                        <li class="list-group-item">
                                            <b>收藏数</b> <a class="float-right" th:text="${detail.user.favoriteCount}">1,322</a>
                                        </li>
                                        <li class="list-group-item">
                                            <b>关注数</b> <a class="float-right" th:text="${detail.user.followCount}">543</a>
                                        </li>
                                        <li class="list-group-item">
                                            <b>被关注数</b> <a class="float-right" th:text="${detail.user.followedCount}">13,287</a>
                                        </li>
                                    </ul>

<!--                                    <a href="#" class="btn btn-primary btn-block"><b>Follow</b></a>-->
                                </div>
                                <!-- /.card-body -->
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="card direct-chat direct-chat-warning">
                                <div class="card-header">
                                    <h3 class="card-title">基本信息</h3>
                                </div>
                                <div class="invoice p-3 mb-3">
                                    <div class="  row invoice-info">
                                        <div class="col-sm-7 invoice-col"  >
                                            <span class="stitle">生日:</span> <span class="scontent"  >
                                            <cms:time timeInt="${detail.user.userBirth}"></cms:time>
                                        </span> <br>
                                            <span class="stitle"> 性别:</span>

                                                                                        <span class="scontent"  th:switch="${detail.user.userGender}">
                                            <!--                                                //户口性质:1,非农业;2.农业-->
                                                                                                <span  th:case="0" >保密</span>
                                                                                                <span  th:case="1" >非农业</span>
                                                                                                <span  th:case="2" >农业</span>
                                                                                        </span><br>
                                            <span class="stitle">手机号: </span> <span class="scontent"  th:text="${detail.user.userMobile}" ></span> <br>
                                            <span class="stitle">省:</span> <span class="scontent"   th:text="${detail.user.provinceName}"></span> <br>
                                            <span class="stitle">市:</span>   <span class="scontent" th:text="${detail.user.cityName}" ></span> <br>
                                            <span class="stitle">区:</span>   <span class="scontent" th:text="${detail.user.districtName}" ></span> <br>
                                            <span class="stitle">地址:</span>   <span class="scontent" th:text="${detail.user.userAddress}" ></span> <br>
<!--                                            <span class="stitle">体重(kg):</span>   <span class="scontent"  ></span> <br>-->
<!--                                            <span class="stitle">出生日期:</span>   <span class="scontent" ></span><br>-->
<!--                                            <span class="stitle">签发机关:</span>     <span class="scontent"  ></span><br>-->
<!--                                            <span class="stitle">籍贯:</span>      <span class="scontent"  ></span>  <br>-->
<!--                                            <span class="stitle">户籍地址:</span>    <span class="scontent"  ></span><br>-->
<!--                                            <span class="stitle">婚姻状况:</span>-->
<!--                                            <span class="scontent"  th:switch="${detail.base.mstate}">-->
<!--&lt;!&ndash;                                                 //婚姻状况:1.未婚;2.已婚;3.离异;4.丧偶&ndash;&gt;-->
<!--                                                     <span  th:case="1" >未婚</span>-->
<!--                                                     <span  th:case="2" >已婚</span>-->
<!--                                                     <span  th:case="3" >离异</span>-->
<!--                                                     <span  th:case="4" >丧偶</span>-->
<!--                                            </span> <br>-->
<!--                                            <span class="stitle">政治面貌:</span>-->
<!--                                            <span class="scontent"  th:switch="${detail.base.ptype}">-->
<!--&lt;!&ndash;                                                //政治面貌:1.中共党员;2.共青团员;3.民革党员;4.民盟盟员;5.民建会员;6.民进会员;7.无党派人士;8.群众&ndash;&gt;-->
<!--                                                    <span  th:case="1" >中共党员</span>-->
<!--                                                     <span  th:case="2" >共青团员</span>-->
<!--                                                     <span  th:case="3" >民革党员</span>-->
<!--                                                     <span  th:case="4" >民盟盟员</span>-->
<!--                                                     <span  th:case="5" >民建会员</span>-->
<!--                                                     <span  th:case="6" >民进会员</span>-->
<!--                                                     <span  th:case="7" >无党派人士</span>-->
<!--                                                     <span  th:case="8" >群众</span>-->
<!--                                            </span> <br>-->
<!--                                            <span class="stitle">户口性质:</span>-->
<!--                                            <span class="scontent"  th:switch="${detail.base.rtype}">-->
<!--&lt;!&ndash;                                                //户口性质:1,非农业;2.农业&ndash;&gt;-->
<!--                                                    <span  th:case="1" >非农业</span>-->
<!--                                                    <span  th:case="2" >农业</span>-->
<!--                                            </span><br>-->


                                        </div>


                                    </div>
                                </div>
                            </div>
                            <!--/.direct-chat -->
                        </div>
                        <div class="col-md-12">
                        <div class="card">
                            <!-- /.card-header -->
                            <div class="card-body"  th:if="${detail.user.userState!=1}">
                                <div class="form-group row">
                                    <label for="dataName" class="col-sm-3 col-form-label">用户状态</label>
                                    <input  type="hidden"  id="userId"  th:value="${detail.user.userId}">
                                    <div class="col-sm-8">
<!--                                        0.未审核;1.审核通过;2.待审核-->
                                        <select class="form-control"  id="state">
                                            <option value="0" th:selected="${detail.user.userState==0}">未审核</option>
                                            <option value="1" th:selected="${detail.user.userState==1}">审核通过</option>
                                            <option value="2" th:selected="${detail.user.userState==2}">待审核</option>
                                        </select>
                                        <!--                                    <label class="help-block m-b-none" for="dataName"-->
                                        <!--                                           id="dataName-error"><i class="far fa-bell"></i>必填项</label>-->
                                    </div>
                                </div>
<!--                                <div class="form-group row">-->
<!--                                    <label for="ctime" class="col-sm-3 col-form-label">到岗日期</label>-->
<!--                                    <div class="col-sm-8">-->
<!--                                        <input type="text" class="form-control" name="ctime" required="required"-->
<!--                                               id="ctime" aria-required="true"  >-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                                <div class="form-group row">-->
<!--                                    <label for="examinerevaluate" class="col-sm-3 col-form-label">综合评价</label>-->
<!--                                    <div class="col-sm-8">-->
<!--                                    <textarea type="text" class="form-control" name="examinerevaluate" required="required"-->
<!--                                              id="examinerevaluate" aria-required="true"  ></textarea>-->
<!--                                    </div>-->
<!--                                </div>-->
                                <!--                            <div class="form-group row">-->
                                <a href="javascript:void(0)" style=""  onclick="saveC()">保存</a>
                                <a href="javascript:void(0)" style="float: right"   id="back"  >返回</a>
                                <!--                            </div>-->
                            </div>
                            <!-- /.row -->


                        </div>
                        </div>
                        <!-- /.col -->


                        <!-- /.col -->
                    </div>
                    <!-- /.row -->
                </div>
                <div class="col-md-4">
                    <div class="row">
                        <div class="col-md-12">
                            <!-- USERS LIST -->
                            <div class="card">
                                <div class="card-header">
                                    <h3 class="card-title">专业信息</h3>
                                </div>

                                <div class="modal-body  "  th:each="bean:${detail.userMajorList}">
                                    <span> 专业名：[[${bean.majorName}]]</span><br>
                                    <span> 分类：
                                          <span class="scontent"  th:switch="${bean.majorType}">
                                            <!--                                                1.本科;2.硕士;3.博士;4.专科-->
                                                                                                <span  th:case="1" >本科</span>
                                                                                                <span  th:case="2" >硕士</span>
                                                                                                <span  th:case="3" >博士</span>
                                                                                                <span  th:case="4" >专科</span>
                                                                                        </span></span><br>
                                    <span> 入学专业年级名：[[${bean.enterName}]]</span><br>
                                    <span> 毕业专业年份名：[[${bean.graduateName}]]</span><br>
                                    <span> 入学年份：[[${bean.enterYear}]]</span><br>
                                    <span> 毕业年份：[[${bean.graduateYear}]]</span><br>
                                    <span> 是否公开：
                                      <span class="scontent"  th:switch="${bean.isOpen}">
                                            <!--                                                1.本科;2.硕士;3.博士;4.专科-->
                                                                                                <span  th:case="1" >公开</span>
                                                                                                <span  th:case="0" >不公开</span>
                                                                                        </span>
                                    </span><br>
                                </div>
                                <!-- /.card-body -->

                            </div>
                            <!--/.card -->
                        </div>
                    </div>

                </div>
                <div class="col-md-3">
                    <div class="card">
                        <div class="card-header">
                            <h3 class="card-title"> 工作经历</h3>
                        </div>
                        <div class="modal-body  "  th:each="bean:${detail.userWorkList}">
                            <span> 公司名称：[[${bean.workName}]]</span><br>
                            <span> 职位：[[${bean.workTitle}]]</span><br>
                            <span> 开始年份：[[${bean.startYear}]]</span><br>
                            <span> 结束年份：[[${bean.endYear}]]</span><br>
                            <span> 是否公开：  <span class="scontent"  th:switch="${bean.isOpen}">
                                            <!--                                                1.本科;2.硕士;3.博士;4.专科-->
                                                                                                <span  th:case="1" >公开</span>
                                                                                                <span  th:case="0" >不公开</span>
                                                                                        </span>
                            </span><br>
                        </div>
                    </div>
                </div>


            </div>

        </section>








    </div>
</div>
<!-- ./wrapper -->
<div th:include="include/foot"></div>

<script>
    function  saveC(){
        let  id=$('#userId').val()
        let  state=$("#state").find("option:selected").val()

        console.log(id,state)
        $.ajax({
            type: 'POST',
            url: "../tbUser/update?uId=" + id+'&state='+state,
            success: function(result){
                console.log(result)
                if (result.stat==10000){
                    layer.msg('修改成功', {icon: 1});
                }
            },error:function(e){
                layer.msg(e.responseText, {icon: 5});
            }

        });
    }
    $("#ctime").datepicker({
        format: 'yyyy-mm-dd ',
        todayBtn: "linked",
        keyboardNavigation: false,
        forceParse: false,
        calendarWeeks: true,
        autoclose: true,
        clearBtn: true,//清除按钮
        minView: 1, //视图展示
    });
    function  savecontent(obj){
        let id=$(obj).attr("data")
        $('#content'+id).show()
        $('#edit'+id).hide()
        $('#'+id).show()
        $('#save'+id).hide()
        let   dsccore  = $('#dsccore'+id).val()
        let   cid  = $('#cid'+id).val()
        let   did  = $('#did'+id).val()
        let devaluate  =  $('#devaluate'+id).text()
        console.log( id,dsccore,devaluate)
        $.ajax({
            type: 'POST',
            url: "../candidate/test_edit?cid=" + cid+'&dsccore='+dsccore+'&devaluate='+devaluate+'&did='+did,
            success: function(result){
                console.log(result)
                if (result.mess=='success'){
                    $('#cdsccore'+id).text(dsccore)
                    $('#cdevaluate'+id).text(devaluate)
                    layer.msg('修改成功', {icon: 1});
                }

            }
        });

    }

    function edit (obj){
        let  id=obj.id
        console.log(obj.id)
        $('#content'+id).hide()
        $('#edit'+id).show()
        $('#'+id).hide()
        $('#save'+id).show()

    }

    $(document).on("click",".fa-plus",function() {
        let   baseId= $('#baseId  option:selected').val()
        var  cno=$("select[name='dId']").length+1;
        console.log(cno)
        if(baseId){
            $.ajax({
                type: 'POST',
                url: "../process/getdata?id=" + baseId,
                success: function(result){
                    console.log(result)
                    let  newcontent='<div class="form-group row"  >'+
                        '<label for="processName" class="col-sm-2 col-form-label">第'+cno+'步</label>\n' +
                        '\t\t\t\t\t\t\t\t<div class="col-sm-8">\n' +
                        '\t\t\t\t\t\t\t\t\t<select  class="form-control"   id="dId'+cno+'" name="dId"  required>\n' +
                        '\t\t\t\t\t\t\t\t\t\t<option value="">请选择</option>\n' +
                        result+
                        '\t\t\t\t\t\t\t\t\t</select>\n' +
                        '\t\t\t\t\t\t\t\t\t<label class="help-block m-b-none" for="dId'+cno+'"\n' +
                        '\t\t\t\t\t\t\t\t\t\t   id="dId'+cno+'-error"><i class="far fa-bell"></i>必填项</label>\n' +
                        '\n' +
                        '\t\t\t\t\t\t\t\t</div>\n' +
                        '\t\t\t\t\t\t\t\t<div class="col-sm-1">\n' +
                        '\t\t\t\t\t\t\t\t\t<i class="fas fa-plus"></i>\n' +
                        '\t\t\t\t\t\t\t\t\t<i class=" fas fa-minus" style="margin-left: 20px;"></i>\n' +
                        '\t\t\t\t\t\t\t\t</div>'+
                        '\t\t\t\t\t\t\t\t</div>'

                    $('#content').append(newcontent)
                }
            });




        }else {
            layer.alert("请选择部门")
        }



    });
    $(document).on("click",".fa-minus",function() {
        var  cno=$("select[name='dId']").length;
        console.log(cno)
        if(cno>1){
            $(this).parent().parent().remove();
        }else {

        }



    });
    $("#addex").click(function(){
        let  id=$('#id').val();
        console.log(id)
        // return;
        layer.open({
            type: 2,
//		        closeBtn:0,
            title: false,
            area: ['50%', '95%'],
            content: 'select_experts?id='+id,
        });
    });
    $("#addPic").click(function(){
        $("#file").click();
    });
    $("#back").click(function() {
        location.href = 'TbUserList';
    });
    $("#file").change(function(e){
        if($(this).val()!=''){
            $("#fileupload").ajaxSubmit({
                success:function(e){
                    console.log(e);
                    if(e.res){
                        $('.filediv').each(function(i,e){
                            if(i>0){
                                $(e).remove();
                            }
                        });
                        let filediv= $(".filediv:eq(0)");
                        let filedivclone=filediv.clone(true);
                        filedivclone.find('img').attr('src',e.url);
                        filedivclone.find('input').attr('name','picUrl');
                        filedivclone.find('input').attr('value',e.url);
                        filedivclone.show();
                        filedivclone.appendTo(filediv.parent());
                        $("#file").val("")
                    }

                },error:function(e){
                    layer.msg(e.responseText, {icon: 5});
                }
            });
        }

    });
    // 	var elem = document.querySelector('.js-switch');
    // 	var switchery = new Switchery(elem, { color: '#1AB394' });
    var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));
    elems.forEach(function(html) {
        var switchery = new Switchery(html, { color: '#1AB394' });
    });

    $.validator.setDefaults({
        ignore: "",
        highlight : function(a) {
            $(a).removeClass("is-valid").addClass("is-invalid");
        },
        success : function(a) {
            $(a).prev().removeClass("is-invalid").addClass("is-valid");
            $(a).html('<i class="fas fa-check"></i>验证成功');
        },
        errorClass : "help-block m-b-none",
// 			validClass : "help-block m-b-none",
        errorPlacement : function(a, b) {
            if (b.is(":radio") || b.is(":checkbox")) {
                a.appendTo(b.parent().parent().parent())
            } else {
                a.appendTo(b.parent())
            }
        },
        submitHandler:function(form){

            form.submit();
        }
    });
    $.validator.addMethod("checkFile",function(value,element){
        let files=$("input[name='fileurls']");
        if(files.length==0){
            return true;
        }
        return false;
    },"");
    $.validator.addMethod("mobile", function(value, element) {
        var myreg=/^[1][3,4,5,6.7,8,9][0-9]{9}$/;
        var length = value.length;
        return this.optional(element) || (length == 11 && myreg.test(value));
    }, "手机号码格式错误!");
    $("#form").validate(
        {
            ignore : "",
            rules : {
                goodsName : "required",
                doctorPhone: {
                    required:true,
                    mobile:true
                },
                filehidden : {
                    required:true
                },
                attrs : {
                    required:true
                },

            },
            messages : {
                goodsName : '<i class="far fa-times-circle"></i>请输入商品名称',
                filehidden : '<i class="far fa-times-circle"></i>请上传图片',
                attrs : '<i class="far fa-times-circle"></i>请选择关联专家',
            }
        });
    function validaBef(){


        if($("#state3").prop("checked")){
            $("#processState").val("1");
        }else{
            $("#processState").val("0");
        }
        let code=$('.textarea').summernote('code');
        $(".textarea").val(code);
        $("#checkItems").val($('.specsItem:checked').map(function(){return this.value}).get().join(','));
        let file=$("input[name='picUrl']").map(function(){return this.value}).get().join(',');
        $("#filehidden").attr('value',file);
        if ($("input[name='eId']").length>0){
            $("#attrs").attr('value',$("input[name='eId']").length);
        }


        if($("#form").validate()){
            $("#form").submit();
        }

    }
    $(document).ready(function (){
        $("#baseId").change(function (){

            let v=$(this).val();
            let t= $(this).find("option:selected").text();
            if(v>0){
                $("#baseName").val(t);
            }
            $.ajax({url:'../process/dataList',data:"baseId="+v,success:function (data){
                    if(data.res){
                        $("#dId").empty();
                        $("#dId").append("<option value=''>请选择</option>");
                        for(let i=0;i<data.list.length;i++){
                            console.log(data.list[i])
                            $("#dId").append("<option value='"+data.list[i].dataId+"'>"+data.list[i].dataName+"</option>");
                        }

                    }
                }})
        });
        $("#departmentId").change(function (){
            let v=$(this).val();
            let t= $(this).find("option:selected").text();
            console.log(v,t)
            if(v>0){
                $("#departmentName").val(t);
            }

        });
        $("#doctorTitlesId").change(function (){
            let v=$(this).val();
            let t= $(this).find("option:selected").text();
            if(v>0){
                $("#doctorTitlesName").val(t);
            }
        });

    });


</script>
</body>
</html>